from streamlit import session_state as ss, data_editor as de, rerun as rr
import pandas as pd


# start_data = {'A': [None, None], 'B': [3, 8], 'C': [None, None]}
#
#
# if 'start_df' not in ss:
#     ss.start_df = pd.DataFrame(start_data)
#     ss.start_df['A'] = pd.to_numeric(ss.start_df['A'], errors='coerce').astype('Int64')
#
#
# edited_df = de(ss.start_df, num_rows='dynamic')
#
# if not ss.start_df.equals(edited_df):
#     ss.start_df = edited_df
#     ss.start_df.loc[ss.start_df['A'].notna(), 'C'] = ss.start_df['A'] + ss.start_df['B']
#     rr()

df_price_gplus=pd.read_sql(sql='''select 
        distinct 站点,币种,erp_sku,
				case when 配送渠道='买家自配送' then 'fbm' when 配送渠道='亚马逊配送' then 'fba' else '' end 配送渠道,原价
        from
        gplus_commodity_management
				where id in (select min(id) id from gplus_commodity_management group by 站点,币种,erp_sku)
    ''',)








